var timer;

var isInSight = function(el) {
    var clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    var elOffsetTop = el.offsetTop;
    var res = elOffsetTop < clientHeight + scrollTop - 100;

    return res;
}
var loadImg = function(el) {
    console.log(el.src)
    if (el.src == '') {
        el.src = el.dataset.src;
    }
}
var lazyLoadImg = function() {
    var imgs = document.querySelectorAll('img');

    for (var i = 0; i < imgs.length; i++) {
        if (isInSight(imgs[i])) {
            loadImg(imgs[i])
        }
    }
}